﻿namespace FrameworkCore.Caches;

public interface ICacheService
{
    Task<T> GetAsync<T>(string key);
    Task SetAsync<T>(string key, T value, TimeSpan absoluteExpirationRelativeToNow);
    Task<bool> RemoveAsync(string key);
    Task<bool> ExistsAsync(string key);
    Task<T> GetOrCreateAsync<T>(string key, Func<Task<T>> valueFactory, TimeSpan absoluteExpirationRelativeToNow);
    Task<T> GetOrCreateAsync<T>(string key, Func<T> valueFactory, TimeSpan absoluteExpirationRelativeToNow);
}
